<extend name="Common/form-ajax" />
<block name="form">
<tr>
    <th>权限列表:</th>
    <td>
        <ul id="CheckTree" class="ztree"></ul>
        <input type="hidden" name="rules" id="RulesValue" value="{$user_group}">
        <input type="hidden" name="id" value="{$id}">
    </td>
</tr>
</block>
<block name="extra">
<script type="text/javascript">
seajs.use(['ztree','dialog'],function(ztree,dialog){
    var setting = {
        check: {enable: true},
        data:{
            simpleData: {enable: true},
        },
    };
    var zNodes = {$node};
    var tree = $.fn.zTree.init($("#CheckTree"), setting, zNodes);
    $('.AjaxForm').submit(function(e) {
        var node = tree.getCheckedNodes(true);
        var data='';
        for (var i = 0; i < node.length; i++) {
            data += node[i].id+',';
        }
        data=data.substr(0,data.length-1);
        $('#RulesValue').val(data);

        return false;
    });

});
</script>
</block>
